﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Linq.Expressions;
using ByteSite.Common;

namespace ByteSite.Web.UI
{
    public partial class BasePage : System.Web.UI.Page
    {
        /// <summary>
        /// 返回支付列表
        /// </summary>
        /// <param name="top">显示条数</param>
        /// <param name="strwhere">查询条件</param>
        /// <returns>DataTable</returns>
        public List<Entitys.dt_site_payment> get_payment_list(int top, string strWhere)
        {
            string where = "is_lock=0";
            if (!string.IsNullOrEmpty(strWhere))
            {
                where = where + " and " + strWhere;
            }

            List<Entitys.dt_site_payment> list = new BLL.site_payment().GetList(top, where);
            return list;
        }

        /// <summary>
        /// 返回支付类型的标题
        /// </summary>
        /// <param name="payment_id">ID</param>
        /// <returns>String</returns>
        public string get_payment_title(int payment_id)
        {
            return new BLL.site_payment().GetTitle(payment_id);
        }

        /// <summary>
        /// 返回支付费用金额
        /// </summary>
        /// <param name="payment_id">支付ID</param>
        /// <param name="total_amount">总金额</param>
        /// <returns>decimal</returns>
        public decimal get_payment_poundage_amount(int payment_id, decimal total_amount)
        {
            Entitys.dt_payment payModel = new BLL.site_payment().GetPaymentModel(payment_id);
            if (payModel == null)
            {
                return 0;
            }
            decimal poundage_amount = Common.Utils.ObjToDecimal(payModel.poundage_amount, 0);
            if (payModel.poundage_type == 1)
            {
                poundage_amount = (poundage_amount * total_amount) / 100;
            }
            return poundage_amount;
        }

    }
}
